package java_test.mtthod;

public class MethodFibonacciSequence {
    public static void main(String[] args) {
        for (int i = 0; i <= 10; i++) {
            System.out.println(i + "数列的和为" + fibonacci(i));
        }
    }

    private static int fibonacci(int i) {
        if (i == 0 || i == 1) {
            return i;
        } else {
            return fibonacci(i - 1) + fibonacci(i - 2);
        }
    }
}
